home *** CD-ROM | disk | FTP | other *** search
/ C & C++ Multimedia Cyber Classroom / C and C++ Multimedia Cyber Classroom (Prentice Hall) (1998).iso / install.sh < prev    next >
Encoding:
Linux/UNIX/POSIX Shell Script  |  1998-03-05  |  34.3 KB  |  995 lines

  1. #!/bin/sh
  2. # install.sh
  3. # Prentice Hall CyberClassroom Solaris installation script.
  4. # Deitel C++ How To Program 2e
  5.  
  6. SCRIPT_NAME="$0"
  7.  
  8. # FUNCTION:     cleanup()
  9. # DESCRIPTION:  To uninstall any aborted attempted install, cleanup the "footprints" of any thing the
  10. #               install did to the user's system, and return with the specified error code.
  11. # ARGUMENTS:    $1 - The error code to exit this script with.
  12. # GLOBALS:      Assumes $UNINSTALL_LINE1 $UNINSTALL_LINE2 $UNINSTALL_LINE3 $UNINSTALL_LINE4 are set if need be.
  13. # RETURN VALUE: NONE
  14. cleanup()
  15. {
  16.   echo
  17.   echo "$SCRIPT_NAME: Installation Aborted, cleaning up..."
  18.   echo
  19.   $UNINSTALL_LINE1
  20.   $UNINSTALL_LINE2
  21.   $UNINSTALL_LINE3
  22.   $UNINSTALL_LINE4
  23.   exit $1
  24. }
  25.  
  26.  
  27. # FUNCTION:     two_value_question()
  28. # DESCRIPTION   As a question of the user for input that has 2 allowable answers.
  29. #               The first argument is the first allowable answer the user can type in and
  30. #               also the default answer if the user just hits the enter key. The second argument
  31. #               is the other allowable answer.  The comparison is case INDEPENDENT, in other
  32. #               words the answer "YeS" is the same as "yes".  Also the first letter of the answer
  33. #               is all that is required, however if the user chooses to type the full allowable answer
  34. #               then ONLY the first character is checked, in other words "Yasdfa" will be interpreted
  35. #               as a valid "YES".
  36. #               
  37. # ARGUMENTS:    $1 - first allowable value and also the prompt default
  38. #               $2 - Second allowable value
  39. # GLOBALS:      Assumes $L1 $L2 $L3 $L4 $L5 $L6 $L7 are set if need be.
  40. # RETURN VALUE: $PROMPT_ANSWER set a the first character of the selected prompt.
  41. two_value_question()
  42. {
  43.   FIRST_CHAR_OF_ARG1=`echo $1 | tr "[:lower:]" "[:upper:]" | awk '{print substr($1,1,1)}'` 
  44.   FIRST_CHAR_OF_ARG2=`echo $2 | tr "[:lower:]" "[:upper:]" | awk '{print substr($1,1,1)}'` 
  45.   QUIT_WHILE=0
  46.   while [ $QUIT_WHILE -eq 0 ]
  47.   do
  48.     echo
  49.     if [ "$L1" != "" ]; then
  50.       echo $L1
  51.     fi
  52.     if [ "$L2" != "" ]; then
  53.       echo $L2
  54.     fi
  55.     if [ "$L3" != "" ]; then
  56.       echo $L3
  57.     fi
  58.     if [ "$L4" != "" ]; then
  59.       echo $L4
  60.     fi
  61.     if [ "$L5" != "" ]; then
  62.       echo $L5
  63.     fi
  64.     if [ "$L6" != "" ]; then
  65.       echo $L6
  66.     fi
  67.     if [ "$L7" != "" ]; then
  68.       echo $L7
  69.     fi
  70.     read A_OR_B
  71.     if [ "$A_OR_B" = "" ]; then
  72.       A_OR_B=$1
  73.     fi
  74.     PROMPT_ANSWER=`echo $A_OR_B | tr "[:lower:]" "[:upper:]" | awk '{print substr($1,1,1)}'`
  75.     if [ "$PROMPT_ANSWER" != "$FIRST_CHAR_OF_ARG1" -a "$PROMPT_ANSWER" != "$FIRST_CHAR_OF_ARG2" ]; then
  76.       echo
  77.       echo "Please answer with \"$1\"" or \"$2\"".  Try again."
  78.     else
  79.       QUIT_WHILE=1
  80.     fi
  81.   done
  82.   return 0
  83. }
  84.  
  85.  
  86. trap 'echo;echo "Ctrl-C detected";echo;cleanup 1' 2
  87.  
  88. CYBERCLASSROOM_JRE_VERSION="1.1.5"
  89. CYBERCLASSROOM_JRE_DIRECTORY="jre1.1.5"
  90. CYBERCLASSROOM_VIEWER_VERSION="1.2.0"
  91. #SOLARIS_JRE_RUNTIME=jre115-solaris2-sparc.exe
  92. SOLARIS_JRE_RUNTIME=jre115s.exe
  93. CDROM_DIR=`/usr/bin/pwd`
  94. CYBERCLASSROOM_BOOK_DIR=cpphtp2
  95. CYBERCLASSROOM_BOOK_FILE=cpphtp2.jar
  96. CYBERCLASSROOM_INITIALIZATION_FILE=webdb.ini
  97. CYBERCLASSROOM_HTML_FILE=cpphtp2.htm
  98. CYBERCLASSROOM_VIEWER_DIR=viewer
  99. CYBERCLASSROOM_BOOK_SCRIPT=cpphtp2.sh
  100. CYBERCLASSROOM_BOOK_UNINSTALL_SCRIPT=uninstall.sh
  101. # This book requires at least 350MB of disk space for Full Installation.
  102. CYBERCLASSROOM_BOOK_REQUIRED_SPACE_IN_MB_FOR_FULL=350
  103. CYBERCLASSROOM_BOOK_REQUIRED_SPACE_IN_MB_FOR_COMPACT=35
  104. CYBERCLASSROOM_BOOK_REQUIRED_SPACE_IN_K_FOR_FULL=358400
  105. CYBERCLASSROOM_BOOK_REQUIRED_SPACE_IN_K_FOR_COMPACT=35840
  106.  
  107. UNINSTALL_LINE1=""
  108. UNINSTALL_LINE2=""
  109. UNINSTALL_LINE3=""
  110. UNINSTALL_LINE4=""
  111.  
  112. echo
  113. echo "********************************************************************"
  114. echo "** Welcome to the Prentice Hall CyberClassroom Installation Script *"
  115. echo "**                                                                 *"
  116. echo "** Please follow the prompts where requested.  Options for each    *"
  117. echo "** prompt are enclosed inside circular parenthesis () characters.  *"
  118. echo "** Only the first character for each prompt is necessary, such as  *"
  119. echo "** \"y\" for \"yes\" and \"n\" for \"no\". Default values for each         *"
  120. echo "** prompt are enclosed inside [] characters.                       *"
  121. echo "********************************************************************"
  122.  
  123. # No arguments required for this script
  124. if [ $# -ne 0 ]; then
  125.   echo
  126.   echo "Note: no arguments are required for this installation script."
  127.   echo "The arguments will be ignored."
  128.   echo
  129. fi
  130.  
  131. # Warning message if the current user is not "root"
  132. if [ "$USER" != "root" ]; then
  133.   L5=""; L6=""; L7=""
  134.   L1="WARNING: This installation script creates files and directories "
  135.   L2="on local mount points.  Unless you have proper file permissions "
  136.   L3="the installation may not proceed properly."
  137.   L4="Continue installation as user \"$USER\" ? (yes|no) [no]: \c"
  138.   two_value_question no yes 
  139.   if [ "$PROMPT_ANSWER" != "Y" ]; then
  140.     cleanup 5
  141.   fi
  142.   echo
  143. fi
  144.  
  145.  
  146. INSTALL_JRE=1
  147. JRE_LOCATION=/opt
  148.  
  149.  
  150. L2=""; L3=""; L4=""; L5=""; L6=""; L7=""
  151. L1="Do you have the SunSoft JRE installed ? (yes|no) [no]: \c"
  152. two_value_question no yes
  153. if [ "$PROMPT_ANSWER" = "Y" ]; then
  154.   while [ 1 ]
  155.   do
  156.     JRE_LOCATION=/opt
  157.     INSTALL_JRE=0
  158.  
  159.     # Ask for the "jre" in the current path
  160.     echo
  161.     echo "Where is the SunSoft JRE installed ? (ex: \"/opt/apps/jre${CYBERCLASSROOM_JRE_VERSION}\"): \c"
  162.     read RESPONSE
  163.     if [ "$RESPONSE" = "" ]; then
  164.       echo
  165.       echo "You must type a location, such as \"/opt/apps/jre${CYBERCLASSROOM_JRE_VERSION}\".  Try again."
  166.       echo
  167.       continue
  168.     fi
  169.  
  170.     JRE_LOCATION=$RESPONSE
  171.  
  172.     # Check to see if the user is right
  173.     if [ ! -d $JRE_LOCATION ]; then
  174.         echo
  175.         echo "The directory \"$JRE_LOCATION\" does not exist on your system."
  176.         echo "Please try another path."
  177.         echo
  178.         continue
  179.     fi
  180.  
  181.     # OK Now we have the location
  182.     JRE_EXECUTABLE=$JRE_LOCATION/bin/jre
  183.  
  184.     # Check for the JRE and run it, make sure its the version
  185.     # CyberClassroom needs or a version
  186.     # that is later.
  187.     if [ ! -f $JRE_EXECUTABLE ]; then
  188.       TMP_JRE_LOCATION=$JRE_LOCATION/jre${CYBERCLASSROOM_JRE_VERSION}
  189.       TMP_JRE_EXECUTABLE=$TMP_JRE_LOCATION/bin/jre
  190.       if [ ! -f $TMP_JRE_EXECUTABLE ]; then
  191.         L5=""; L6=""; L7=""
  192.         L1="The executable \"$TMP_JRE_EXECUTABLE\" does not exist "
  193.         L2="Maybe there is a damaged installation of a previous JRE."
  194.         L3="Do you wish to reinstall the JRE in the directory"
  195.         L4="\"$JRE_LOCATION\" ? (yes/no) [yes]: \c"
  196.         two_value_question yes no
  197.         if [ "$PROMPT_ANSWER" = "Y" ]; then
  198.           INSTALL_JRE=1
  199.           break
  200.         else
  201.           L2=""; L3=""; L4=""; L5=""; L6=""; L7=""
  202.           L1="Choose another location? (yes/no) [yes]: \c"
  203.           two_value_question yes no
  204.           if [ "$PROMPT_ANSWER" = "Y" ]; then
  205.             continue
  206.           else
  207.             echo
  208.             echo "$0: ERROR: A possibly damaged installation of the JRE was detected"
  209.             echo "in the directory \"$JRE_LOCATION\"."
  210.             echo "Please correct this problem and run this installation again."
  211.             cleanup 15
  212.           fi
  213.         fi
  214.       else
  215.         JRE_LOCATION=$TMP_JRE_LOCATION
  216.         JRE_EXECUTABLE=$TMP_JRE_EXECUTABLE
  217.       fi
  218.     fi
  219.  
  220.     CURRENT_JRE=`$JRE_EXECUTABLE -help 2>&1 | grep -i Version | awk '{print $NF}'`
  221.     if [ `echo $CURRENT_JRE | awk -F. '{print $1$2$3$4}'` -ne `echo $CYBERCLASSROOM_JRE_VERSION | awk -F. '{print $1$2$3$4}'` ]; then
  222.       L7=""
  223.       L1="The JRE executable [$CURRENT_JRE] on your system"
  224.       L2="is not the version used by the CyberClassroom JRE "
  225.       L3="[jre version \"$CYBERCLASSROOM_JRE_VERSION\"]."
  226.       L4="If you are using a version older than this,"
  227.       L5="it is recommended you install the CyberClassroom JRE version as well."
  228.       L6="Continue and use existing JRE  ? (yes/no) [no]: \c"
  229.       two_value_question no yes
  230.       if [ "$PROMPT_ANSWER" = "Y" ]; then
  231.         INSTALL_JRE=0
  232.       else
  233.         INSTALL_JRE=1
  234.       fi
  235.       break
  236.     else
  237.       break
  238.     fi
  239.  
  240.   done
  241.  
  242. fi
  243.  
  244. # If the JRE needs installing do it now
  245.  
  246. while [ 1 ]
  247. do
  248. if [ $INSTALL_JRE -eq 1 ]; then
  249.   echo
  250.   echo "You are about to install the SunSoft JRE version $CYBERCLASSROOM_JRE_VERSION."
  251.   echo "Please conform to all licensing agreements."
  252.   echo "NOTE: The installer will create a directory named (jre${CYBERCLASSROOM_JRE_VERSION})"
  253.   echo "      inside the directory you specify.  For example, if you specify \"/opt\" in"
  254.   echo "      response to the prompt below, the JRE will be installed in directory "
  255.   echo "      \"/opt/jre${CYBERCLASSROOM_JRE_VERSION}\""
  256.   echo "Where do we install the SunSoft JRE (full directory path) ? [$JRE_LOCATION]: \c"
  257.   read RESPONSE
  258.   if [ "$RESPONSE" != "" ]; then
  259.     JRE_LOCATION=$RESPONSE
  260.   fi
  261.   L2=""; L3=""; L4=""; L5=""; L6=""; L7=""
  262.   L1="Install SunSoft JRE in directory ($JRE_LOCATION) creating if necessary ? (yes/no) [yes]: \c  "
  263.   two_value_question yes no
  264.   if [ "$PROMPT_ANSWER" = "N" ]; then
  265.     L2=""; L3=""; L4=""; L5=""; L6=""; L7=""
  266.     L1="Choose another location ? (yes/no) [yes]: \c"
  267.     two_value_question yes no
  268.     if [ "$PROMPT_ANSWER" = "Y" ]; then
  269.       continue
  270.     else
  271.       cleanup 20
  272.     fi
  273.   fi
  274.  
  275.   # Check if destination directory exists, remove the whole thing!!!
  276.   if [ -d $JRE_LOCATION ]; then
  277.     if [ -d $JRE_LOCATION/jre${CYBERCLASSROOM_JRE_VERSION} ]; then
  278.       L4=""; L5=""; L6=""; L7=""
  279.       L1="The JRE Directory \"$JRE_LOCATION/jre${CYBERCLASSROOM_JRE_VERSION}\" already exists."
  280.       L2="To avoid any possible problems, this directory should be cleaned before installation."
  281.       L3="Remove all files in $JRE_LOCATION/jre${CYBERCLASSROOM_JRE_VERSION}? (yes/no) [yes]: \c"
  282.       two_value_question yes no
  283.       if [ "$PROMPT_ANSWER" = "Y" ]; then
  284.  
  285.         rm -rf $JRE_LOCATION/jre${CYBERCLASSROOM_JRE_VERSION}
  286.         if [ $? -ne 0 ]; then
  287.           echo
  288.           echo "$0: ERROR: following system command failed:"
  289.           echo "\"rm -rf $JRE_LOCATION/jre${CYBERCLASSROOM_JRE_VERSION}\""
  290.           echo "Unable to remove an old installation of the JRE."
  291.           echo
  292.           cleanup 25
  293.         fi
  294.  
  295.       fi
  296.     fi
  297.  
  298.     UNINSTALL_LINE1="rm -rf $JRE_LOCATION/jre${CYBERCLASSROOM_JRE_VERSION}"
  299.  
  300.   else
  301.  
  302.     mkdir $JRE_LOCATION
  303.     if [ $? -ne 0 ]; then
  304.       echo
  305.       echo "$0: ERROR: following system command failed:"
  306.       echo "\"mkdir $JRE_LOCATION\""
  307.       echo "Unable to create a new directory for the JRE."
  308.       echo
  309.       cleanup 30
  310.     fi
  311.  
  312.     UNINSTALL_LINE1="rm -rf $JRE_LOCATION"
  313.  
  314.   fi
  315.  
  316.   cp ./$SOLARIS_JRE_RUNTIME $JRE_LOCATION
  317.   if [ $? -ne 0 ]; then
  318.     echo
  319.     echo "$0: ERROR: following system command failed:"
  320.     echo "\"cp  ./$SOLARIS_JRE_RUNTIME $JRE_LOCATION\""
  321.     echo "Unable to install JRE."
  322.     echo
  323.     cleanup 35
  324.   fi
  325.  
  326.   chmod a+x $JRE_LOCATION/$SOLARIS_JRE_RUNTIME
  327.   if [ $? -ne 0 ]; then
  328.     echo
  329.     echo "$0: ERROR: following system command failed:"
  330.     echo "\"chmod a+x $JRE_LOCATION/$SOLARIS_JRE_RUNTIME\""
  331.     echo "Unable to install JRE."
  332.     echo
  333.     cleanup 40
  334.   fi
  335.  
  336.   (cd $JRE_LOCATION;./$SOLARIS_JRE_RUNTIME)
  337.   if [ $? -ne 0 ]; then
  338.     echo
  339.     echo "$0: ERROR: following system command failed:"
  340.     echo "\"(cd $JRE_LOCATION;./$SOLARIS_JRE_RUNTIME)\""
  341.     echo "Unable to install JRE."
  342.     echo
  343.     cleanup 45
  344.   fi
  345.  
  346.   # Remove the local copy of the JRE Runtime
  347.   rm -rf $JRE_LOCATION/$SOLARIS_JRE_RUNTIME
  348.   if [ $? -ne 0 ]; then
  349.     echo
  350.     echo "$0: ERROR: following system command failed:"
  351.     echo "\"rm -rf $JRE_LOCATION/$SOLARIS_JRE_RUNTIME\""
  352.     echo "Unable to install JRE."
  353.     echo
  354.     cleanup 50
  355.   fi
  356.  
  357.   JRE_LOCATION=$JRE_LOCATION/jre${CYBERCLASSROOM_JRE_VERSION}
  358.  
  359. fi
  360. break
  361. done
  362.  
  363. # Now install the actuall CyberClassroom Viewer and the Deitel Book
  364. # Ask if the want to install it locally or leave it on the CDROM.         
  365. # Check for previous CyberClassroom and remove if older.
  366. # Check to see if there is space to install.
  367. # Finally, write the commands necessary to do the unistallation script.
  368.  
  369. echo
  370. echo "You are about to proceed with the Cyber Classroom installation."
  371. echo
  372. echo "\"Compact\" Installation requires approximately $CYBERCLASSROOM_BOOK_REQUIRED_SPACE_IN_MB_FOR_COMPACT MB of disk space."
  373. echo "All of the data files are installed on your local hard disk, EXCEPT"
  374. echo "the audio files, which remain on the CD-ROM.  Links to these large"
  375. echo "files are created on your hard drive.  This means you MUST have the "
  376. echo "CD-ROM in your CD-ROM drive in order to run the Cyber Classroom."
  377. echo
  378. echo "\"Full\" Installation requires approximately $CYBERCLASSROOM_BOOK_REQUIRED_SPACE_IN_MB_FOR_FULL MB of disk space."
  379. echo "All of the data files are installed your local hard disk, INCLUDING"
  380. echo "the audio files.  You do not need the CD-ROM in your CD-ROM drive"
  381. echo "to run the Cyber Classroom."
  382. echo
  383.  
  384. L2=""; L3=""; L4=""; L5=""; L6=""; L7=""
  385. L1="Which installation option do you choose ? (Compact/Full) [Compact]: \c"
  386. two_value_question Compact Full
  387. if [ "$PROMPT_ANSWER" = "C" ]; then
  388.   INSTALLATION_OPTION="Compact"
  389. else
  390.   INSTALLATION_OPTION="Full"
  391. fi
  392.  
  393.  
  394. # OK installation type determined lets check disk space 
  395.  
  396. if [ "$INSTALLATION_OPTION" = "Compact" ]; then
  397.   CYBERCLASSROOM_BOOK_REQUIRED_SPACE_IN_K=$CYBERCLASSROOM_BOOK_REQUIRED_SPACE_IN_K_FOR_COMPACT
  398. else
  399.   CYBERCLASSROOM_BOOK_REQUIRED_SPACE_IN_K=$CYBERCLASSROOM_BOOK_REQUIRED_SPACE_IN_K_FOR_FULL
  400. fi
  401.  
  402. echo
  403. echo "Installation Mode \"$INSTALLATION_OPTION\" Chosen....."
  404. echo
  405.  
  406.  
  407. while [ 1 ]
  408. do
  409.   CYBERCLASSROOM_LOCATION=/opt/CyberClassroom
  410.   echo
  411.   echo "Note: If you have done previous installation of any CyberClassroom"
  412.   echo "product, it is suggested you use the same directory as before."
  413.   echo "This will eliminate duplicate copies of the CyberClassroom Viewer"
  414.   echo "Where do we install the CyberClassroom (full directory path) ? [$CYBERCLASSROOM_LOCATION]: \c"
  415.  
  416.   read RESPONSE
  417.  
  418.   # if it's not null then don't use the default prompt answer
  419.   if [ "$RESPONSE" != "" ]; then
  420.     CYBERCLASSROOM_LOCATION=$RESPONSE
  421.   fi  
  422.  
  423.   # Check to see if the main directory exists
  424.   if [ ! -d $CYBERCLASSROOM_LOCATION ]; then
  425.  
  426.     L4=""; L5=""; L6=""; L7=""
  427.     L1="The directory you have chosen"
  428.     L2="\"$CYBERCLASSROOM_LOCATION\""
  429.     L3="does not exist. Create Directory Now ? (yes/no) [yes]: \c"
  430.     two_value_question yes no
  431.     if [ "$PROMPT_ANSWER" = "Y" ]; then
  432.  
  433.       mkdir $CYBERCLASSROOM_LOCATION
  434.       if [ $? -ne 0 ]; then
  435.         echo
  436.         echo "$0: ERROR: following system command failed:"
  437.         echo "\"mkdir $CYBERCLASSROOM_LOCATION\""
  438.         echo "Unable to create directory <$CYBERCLASSROOM_LOCATION>."
  439.         echo
  440.         DIR_OK=0
  441.       else
  442.         UNINSTALL_LINE4="rm -rf $CYBERCLASSROOM_LOCATION"
  443.         DIR_OK=1
  444.       fi
  445.     # Prompt answer as no
  446.     else 
  447.       DIR_OK=0
  448.     fi
  449.  
  450.     if [ $DIR_OK -eq 0 ]; then
  451.       L2=""; L3=""; L4=""; L5=""; L6=""; L7=""
  452.       L1="Choose another location? (yes/no) [yes]: \c"
  453.       two_value_question yes no
  454.       if [ "$PROMPT_ANSWER" = "Y" ]; then
  455.         continue
  456.       else
  457.         cleanup 55
  458.       fi
  459.     fi
  460.   fi
  461.  
  462.   # Check for required space in the selected CyberClassroom directory.  We do this by finding what
  463.   # partition this directory is mounted on.  (Ex. /export/home/generic/CyberClassroom is on the /export/home
  464.   # partition.
  465.  
  466.   echo
  467.   echo "Checking Disk Space Requirements....."
  468.   echo
  469.   CURRENT_LOCATION_K=`df -k $CYBERCLASSROOM_LOCATION | tail -1 | awk '{print $4}'`
  470.   if [  $CURRENT_LOCATION_K -le $CYBERCLASSROOM_BOOK_REQUIRED_SPACE_IN_K ]; then
  471.     L5=""; L6=""; L7=""
  472.     L1="WARNING: The directory you selected for $INSTALLATION_OPTION CyberClassroom installation "
  473.     L2="\"$CYBERCLASSROOM_LOCATION\" only has ${CURRENT_LOCATION_K}K of available space."
  474.     L3="in its partition. The CyberClassroom product requires ${CYBERCLASSROOM_BOOK_REQUIRED_SPACE_IN_K}K of space."
  475.     L4="Select Another Location? (yes/no) [yes]: \c"
  476.     two_value_question yes no
  477.     if [ "$PROMPT_ANSWER" = "N" ]; then
  478.       cleanup 60
  479.     fi
  480.   else 
  481.     # Space test succeeded
  482.     break
  483.   fi
  484.  
  485. done
  486.  
  487. # Do check for a Previous CyberClassroom Viewer and ask (or recommend) to replace it if is
  488. # identified as an old version
  489.  
  490. INSTALL_NEW_VIEWING_ENGINE=0
  491. if [ -d $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_VIEWER_DIR ]; then
  492.  
  493.   CURRENT_CYBERCLASSROOM_VERSION=`$JRE_LOCATION/bin/jre -cp $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_VIEWER_DIR/gsl.jar gsl.gui.Classroom -version`
  494.   if [ $? -ne 0 ]; then
  495.     echo
  496.     echo "$0: ERROR: following script command \"$JRE_LOCATION/bin/jre -cp "
  497.     echo "$CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_VIEWER_DIR/gsl.jar gsl.gui.Classroom"
  498.     echo " -version\" failed."
  499.     echo "Unable to determine an existing CyberClassroom Viewer version number."
  500.     echo "A new Viewer will be installed to correct the damaged installation."
  501.     echo
  502.     INSTALL_NEW_VIEWING_ENGINE=1
  503.   else
  504.     if [ `echo $CURRENT_CYBERCLASSROOM_VERSION | awk -F. '{print $1$2$3$4}'` -lt `echo $CYBERCLASSROOM_VIEWER_VERSION | awk -F. '{print $1$2$3$4}'` ]; then
  505.       L6=""; L7=""
  506.       L1="Note: The installation script has determined that you already have a previous installation of"
  507.       L2="the CyberClassroom Viewing Engine (i.e. the "$CYBERCLASSROOM_VIEWER_DIR" directory) and determined that its version"
  508.       L3="($CURRENT_CYBERCLASSROOM_VERSION) is older than the one being installed now ($CYBERCLASSROOM_VIEWER_VERSION)."
  509.       L4="It is STRONGLY recommended that you install the updated version of this viewing engine."
  510.       L5="Shall we proceed and install the new CyberClassroom Viewing Engine ? (yes/no) [yes]: \c"
  511.       two_value_question yes no
  512.       if [ "$PROMPT_ANSWER" = "Y" ]; then
  513.         INSTALL_NEW_VIEWING_ENGINE=1
  514.       fi
  515.     fi
  516.   fi
  517. else
  518.   INSTALL_NEW_VIEWING_ENGINE=1
  519. fi
  520.  
  521. if [ $INSTALL_NEW_VIEWING_ENGINE -eq 1 ]; then
  522.  
  523.   if [ -d $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_VIEWER_DIR ]; then
  524.     rm -rf $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_VIEWER_DIR
  525.     if [ $? -ne 0 ]; then
  526.       echo
  527.       echo "$0: ERROR: following system command failed:"
  528.       echo "\"rm -rf $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_VIEWER_DIR\""
  529.       echo "Unable to remove an old CyberClassroom Viewing Engine."
  530.       echo
  531.       cleanup 65
  532.     fi
  533.   fi
  534.  
  535.   echo
  536.   echo "Copying Viewer Files....."
  537.   echo
  538.  
  539.   cp -R $CYBERCLASSROOM_VIEWER_DIR $CYBERCLASSROOM_LOCATION
  540.   if [ $? -ne 0 ]; then
  541.     echo
  542.     echo "$0: ERROR: following system command failed:"
  543.     echo "\"cp -R $CYBERCLASSROOM_VIEWER_DIR $CYBERCLASSROOM_LOCATION\""
  544.     echo "Unable to install an new CyberClassroom Viewing Engine."
  545.     echo
  546.     cleanup 70
  547.   fi
  548.  
  549.   UNINSTALL_LINE3="rm -rf $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_VIEWER_DIR"
  550.  
  551. fi
  552.  
  553.  
  554.  
  555. # Now, install the book checking for "Compact" or "Full" Installation
  556. # If already there, then remove it first and replace with a new one
  557.  
  558. INSTALL_NEW_BOOK_DIR=0
  559. if [ -d $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR ]; then
  560.   L5=""; L6=""; L7=""
  561.   L1="Note: The installation script has determined that you already"
  562.   L2="have a previous installation of the CyberClassroom Book"
  563.   L3="directory \"$CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR\"."
  564.   L4="Should we reinstall over this directory (answer \"no\" to abort this script) ? (yes/no) [yes]: \c"
  565.   two_value_question yes no
  566.   if [ "$PROMPT_ANSWER" = "Y" ]; then
  567.     INSTALL_NEW_BOOK_DIR=1
  568.   else
  569.     cleanup 73
  570.   fi
  571. else
  572.   INSTALL_NEW_BOOK_DIR=1
  573. fi
  574.  
  575. if [ $INSTALL_NEW_BOOK_DIR -eq 1 ]; then
  576.  
  577.   if [ -d $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR ]; then
  578.     rm -rf $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR
  579.     if [ $? -ne 0 ]; then
  580.       echo
  581.       echo "$0: ERROR: following system command failed:"
  582.       echo "\"rm -rf $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR\""
  583.       echo "Unable to remove an old installation of this CyberClassroom book."
  584.       echo
  585.       cleanup 75
  586.     fi
  587.   fi
  588.  
  589.   echo
  590.   echo "Copying Book Files....."
  591.   echo
  592.  
  593.   # First copy the contents of the "cpphtp2" directory without the jar files, zip files and answers directory. 
  594.   # should use tar method creates the main directory as well as the sub directories if necessary.
  595.  
  596.   tar cvf - `ls -d $CYBERCLASSROOM_BOOK_DIR/* | egrep -v '\.zip$|\.jar$|\/answers$'` | ( cd $CYBERCLASSROOM_LOCATION; tar xvf - )
  597.   if [ $? -ne 0 ]; then
  598.      echo
  599.      echo "$0: ERROR: following system command failed:"
  600.      echo "tar cvf - `ls -d $CYBERCLASSROOM_BOOK_DIR/* | egrep -v '\.zip$|\.jar$|\/answers$'` | ( cd $CYBERCLASSROOM_LOCATION; tar xvf - )"
  601.      echo "Unable to install the CyberClassroom book."
  602.      echo
  603.      cleanup 80
  604.   fi
  605.  
  606.   UNINSTALL_LINE2="$UNINSTALL_LINE2 rm -rf $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR"
  607.  
  608.   # For a "Full" installation, copy the jar and zip files along with the answers directory.
  609.   if [ "$INSTALLATION_OPTION" = "Full" ]; then
  610.     tar cvf - `ls -d $CYBERCLASSROOM_BOOK_DIR/*.jar $CYBERCLASSROOM_BOOK_DIR/*.zip $CYBERCLASSROOM_BOOK_DIR/answers` | ( cd $CYBERCLASSROOM_LOCATION; tar xvf - )
  611.     if [ $? -ne 0 ]; then
  612.        echo
  613.        echo "$0: ERROR: following system command failed:"
  614.        echo "\"tar cvf - `ls $CYBERCLASSROOM_BOOK_DIR/*.jar` | ( cd $CYBERCLASSROOM_LOCATION; tar xvf - )\""
  615.        echo "Unable to install the CyberClassroom book file ($CYBERCLASSROOM_BOOK_FILE)."
  616.        echo
  617.        cleanup 83
  618.     fi
  619.   fi
  620.  
  621.   echo
  622.   echo "Making Setup Files....."
  623.   echo
  624.  
  625.  
  626.   # Make sure the "cpphtp2/webdb.ini" file is properly initialized by
  627.   # recreating it here with its default values.  Also make sure its writtable
  628.   # by any user.
  629.   rm -f  $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_INITIALIZATION_FILE
  630.   cat << EOF > $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_INITIALIZATION_FILE
  631. 0
  632. 0
  633. 0
  634. true
  635. EOF
  636.  
  637.   if [ $? -ne 0 ]; then
  638.     echo
  639.     echo "$0: ERROR: following system command failed:"
  640.     echo "\"cat << EOF > $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_INITIALIZATION_FILE\""
  641.     echo "Unable to create the default setup file ($CYBERCLASSROOM_INITIALIZATION_FILE) for the CyberClassroom book."
  642.     echo
  643.     cleanup 100
  644.   fi
  645.  
  646.   chmod a+w $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_INITIALIZATION_FILE
  647.   if [ $? -ne 0 ]; then
  648.     echo
  649.     echo "$0: ERROR: following system command failed:"
  650.     echo "\"chmod a+w $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_INITIALIZATION_FILE\""
  651.     echo "Unable to change permissions on the default setup file for the CyberClassroom book."
  652.     echo
  653.     cleanup 105
  654.   fi
  655.  
  656.   # Create the "cpphtp2.htm" file based on the installation option.
  657.  
  658.   rm -f  $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_HTML_FILE
  659.   cat << EOF > $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_HTML_FILE
  660. <hr>
  661. <applet code=gsl.gui.Starter width=621 height=421>
  662. EOF
  663.   if [ $? -ne 0 ]; then
  664.     echo
  665.     echo "$0: ERROR: following system command failed:"
  666.     echo "\"cat << EOF > $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_HTML_FILE\""
  667.     echo "Unable to create main html file for the CyberClassroom book."
  668.     echo
  669.     cleanup 110
  670.   fi
  671.  
  672.   if [ "$INSTALLATION_OPTION" = "Full" ]; then
  673.     cat << EOF >> $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_HTML_FILE
  674. <param name=gmlarch value="$CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/cpphtp2.jar;$CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/examples.jar;$CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/intro.zip;$CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/code.jar;$CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/iicons.jar;$CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/graphics.jar;$CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/bckgrnds.jar;$CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/audio.zip;">
  675. EOF
  676.     if [ $? -ne 0 ]; then
  677.       echo
  678.       echo "$0: ERROR: following system command failed:"
  679.       echo "\"cat << EOF >> $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_HTML_FILE\""
  680.       echo "Unable to create main html file for the CyberClassroom book."
  681.       echo
  682.       cleanup 111
  683.     fi
  684.   else
  685.     cat << EOF >> $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_HTML_FILE
  686. <param name=gmlarch value="$CDROM_DIR/$CYBERCLASSROOM_BOOK_DIR/cpphtp2.jar;$CDROM_DIR/$CYBERCLASSROOM_BOOK_DIR/intro.zip;$CDROM_DIR/$CYBERCLASSROOM_BOOK_DIR/examples.jar;$CDROM_DIR/$CYBERCLASSROOM_BOOK_DIR/code.jar;$CDROM_DIR/$CYBERCLASSROOM_BOOK_DIR/iicons.jar;$CDROM_DIR/$CYBERCLASSROOM_BOOK_DIR/graphics.jar;$CDROM_DIR/$CYBERCLASSROOM_BOOK_DIR/bckgrnds.jar;$CDROM_DIR/$CYBERCLASSROOM_BOOK_DIR/audio.zip;">
  687. EOF
  688.     if [ $? -ne 0 ]; then
  689.       echo
  690.       echo "$0: ERROR: following system command failed:"
  691.       echo "\"cat << EOF >> $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_HTML_FILE\""
  692.       echo "Unable to create main html file for the CyberClassroom book."
  693.       echo
  694.       cleanup 112
  695.     fi
  696.   fi
  697.  
  698.   cat << EOF >> $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_HTML_FILE
  699. <param name=book value="cpphtp2.gmlb">
  700. <param name=lastindex value=38>
  701. <param name=fontsize value="16">
  702. <param name=starter value="gsl.gui.vb.VBStarter">
  703. <param name=aliases value="jarexe=xterm -e /bin/sh ">
  704. <param name=jardir value="ism:examples/">
  705. </applet>
  706. <hr>
  707. EOF
  708.   if [ $? -ne 0 ]; then
  709.     echo
  710.     echo "$0: ERROR: following system command failed:"
  711.     echo "\"cat << EOF >> $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_HTML_FILE\""
  712.     echo "Unable to create main html file for the CyberClassroom book."
  713.     echo
  714.     cleanup 113
  715.   fi
  716.  
  717.  
  718. fi # if [ $INSTALL_NEW_BOOK_DIR -eq 1 ]
  719.  
  720. # Now, build the script which will launch the CyberClassroom product for the user
  721. # Again, make sure that its executable by every user.
  722.  
  723. cat << EOF > $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_SCRIPT
  724. PATH=$JRE_LOCATION/bin:$PATH:/usr/openwin/bin
  725. export PATH
  726. jre -cp $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_VIEWER_DIR/gsl.jar:$CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_VIEWER_DIR/ism.jar:$CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_VIEWER_DIR/ui.jar:$CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_VIEWER_DIR/search.jar gsl.gui.Classroom $CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_HTML_FILE &
  727. EOF
  728. if [ $? -ne 0 ]; then
  729.   echo
  730.   echo "$0: ERROR: following system command failed:"
  731.   echo "\"cat << EOF > $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_SCRIPT\""
  732.   echo "Unable to create startup script for the CyberClassroom book."
  733.   echo
  734.   cleanup 120
  735. fi
  736.  
  737. chmod a+x $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_SCRIPT
  738. if [ $? -ne 0 ]; then
  739.   echo
  740.   echo "$0: ERROR: following system command failed:"
  741.   echo "\"chmod a+x $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_SCRIPT\""
  742.   echo "Unable to create startup script for the CyberClassroom book."
  743.   echo
  744.   cleanup 125
  745. fi
  746.  
  747. mkdir $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/CyberClassroom
  748. mkdir $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/CyberClassroom/cpphtp2
  749. mkdir $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/CyberClassroom/cpphtp2/examples
  750. mkdir $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/CyberClassroom/cpphtp2/examples/Source
  751. cp src/*.jar $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/CyberClassroom/cpphtp2/examples/Source
  752.  
  753.  
  754.  
  755.  
  756. # Build a script for uninstallation operation
  757.  
  758. cat << EOF > $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_BOOK_UNINSTALL_SCRIPT
  759. #!/bin/sh
  760. QUIT_WHILE=0
  761. while [ \$QUIT_WHILE -eq 0 ]
  762. do
  763.   echo
  764.   echo "WARNING: This Prentice Hall CyberClassroom uninstallation script"
  765.   echo "will run several system remove commands with verification (assuming you"
  766.   echo "have file permissions to do so of course):"
  767.   echo
  768.   echo "It is recommended that you move this script to a location (such as /tmp) other"
  769.   echo "than a CyberClassroom related directory.  By default, this script is installed"
  770.   echo "in the main CyberClassroom directory.  Since this uninstallation script gives"
  771.   echo "you the option to remove the main CyberClassroom directory in which it resides,"
  772.   echo "you must move this script from there in order for the system remove command to succeed."
  773.   echo
  774.   echo "Do you want to continue ? (yes|no) [no]: \c"
  775.   read YES_OR_NO
  776.   if [ "\$YES_OR_NO" = "" ]; then
  777.     YES_OR_NO="no"
  778.   fi
  779.   PROMPT_ANSWER=\`echo \$YES_OR_NO | tr "[:lower:]" "[:upper:]" | awk '{print substr(\$1,1,1)}'\`
  780.   if [ "\$PROMPT_ANSWER" != "Y" -a "\$PROMPT_ANSWER" != "N" ]; then
  781.     echo 
  782.     echo "Please answer with \\"yes\\" or \\"no\\".  Try again."
  783.   else
  784.     QUIT_WHILE=1
  785.   fi
  786. done
  787. if [ "\$PROMPT_ANSWER" != "Y" ]; then
  788.   echo
  789.   echo "Uninstallation Aborted."
  790.   echo
  791.   exit 1
  792. fi
  793. EOF
  794. if [ $? -ne 0 ]; then
  795.   echo
  796.   echo "$0: ERROR: following system command failed:"
  797.   echo "\"cat << EOF > $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_BOOK_UNINSTALL_SCRIPT\""
  798.   echo "Unable to create uninstallation script for the CyberClassroom book."
  799.   echo
  800.   cleanup 130
  801. fi
  802.  
  803. if [ "$UNINSTALL_LINE2" != "" ]; then
  804. cat << EOF >> $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_BOOK_UNINSTALL_SCRIPT
  805. QUIT_WHILE=0
  806. while [ \$QUIT_WHILE -eq 0 ]
  807. do
  808.   echo
  809.   echo "Remove the CyberClassroom book directory with the system remove command(s):"
  810.   echo "\\"$UNINSTALL_LINE2\\" ? (yes/no) [yes]: \c"
  811.   read YES_OR_NO
  812.   if [ "\$YES_OR_NO" = "" ]; then
  813.     YES_OR_NO="yes"
  814.   fi
  815.   PROMPT_ANSWER=\`echo \$YES_OR_NO | tr "[:lower:]" "[:upper:]" | awk '{print substr(\$1,1,1)}'\`
  816.   if [ "\$PROMPT_ANSWER" != "Y" -a "\$PROMPT_ANSWER" != "N" ]; then
  817.     echo 
  818.     echo "Please answer with \\"yes\\" or \\"no\\".  Try again."
  819.   else
  820.     QUIT_WHILE=1
  821.   fi
  822. done
  823. if [ "\$PROMPT_ANSWER" != "N" ]; then
  824.   echo
  825.   echo "$UNINSTALL_LINE2"
  826.   $UNINSTALL_LINE2
  827. fi
  828. EOF
  829. if [ $? -ne 0 ]; then
  830.   echo
  831.   echo "$0: ERROR: following system command failed:"
  832.   echo "\"cat << EOF > >$CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_BOOK_UNINSTALL_SCRIPT\""
  833.   echo "Unable to create uninstallation script for the CyberClassroom book."
  834.   echo
  835.   cleanup 135
  836. fi
  837. fi
  838.  
  839. if [ "$UNINSTALL_LINE3" != "" ]; then
  840. cat << EOF >> $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_BOOK_UNINSTALL_SCRIPT
  841. QUIT_WHILE=0
  842. while [ \$QUIT_WHILE -eq 0 ]
  843. do
  844.   echo
  845.   echo "(WARNING: If you answer yes to the following question, previous CyberClassroom"
  846.   echo "products may no longer work !!!)"
  847.   echo
  848.   echo "Remove the CyberClassroom viewing engine directory with the system remove command:"
  849.   echo "\\"$UNINSTALL_LINE3\\" ? (yes/no) [yes]: \c"
  850.   read YES_OR_NO
  851.   if [ "\$YES_OR_NO" = "" ]; then
  852.     YES_OR_NO="yes"
  853.   fi
  854.   PROMPT_ANSWER=\`echo \$YES_OR_NO | tr "[:lower:]" "[:upper:]" | awk '{print substr(\$1,1,1)}'\`
  855.   if [ "\$PROMPT_ANSWER" != "Y" -a "\$PROMPT_ANSWER" != "N" ]; then
  856.     echo 
  857.     echo "Please answer with \\"yes\\" or \\"no\\".  Try again."
  858.   else
  859.     QUIT_WHILE=1
  860.   fi
  861. done
  862. if [ "\$PROMPT_ANSWER" != "N" ]; then
  863.   echo
  864.   echo "$UNINSTALL_LINE3"
  865.   $UNINSTALL_LINE3
  866. fi
  867. EOF
  868. if [ $? -ne 0 ]; then
  869.   echo
  870.   echo "$0: ERROR: following system command failed:"
  871.   echo "\"cat << EOF > >$CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_BOOK_UNINSTALL_SCRIPT\""
  872.   echo "Unable to create uninstallation script for the CyberClassroom book."
  873.   echo
  874.   cleanup 140
  875. fi
  876. fi
  877.  
  878. if [ "$UNINSTALL_LINE4" != "" ]; then
  879. cat << EOF >> $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_BOOK_UNINSTALL_SCRIPT
  880. QUIT_WHILE=0
  881. while [ \$QUIT_WHILE -eq 0 ]
  882. do
  883.   echo
  884.   echo "(WARNING: If you answer yes to the following question, previous CyberClassroom"
  885.   echo "products may also be removed !!!)"
  886.   echo
  887.   echo "Remove the entire CyberClassroom directory with system remove command:"
  888.   echo "\\"$UNINSTALL_LINE4\\" ? (yes/no) [no]: \c"
  889.   read YES_OR_NO
  890.   if [ "\$YES_OR_NO" = "" ]; then
  891.     YES_OR_NO="no"
  892.   fi
  893.   PROMPT_ANSWER=\`echo \$YES_OR_NO | tr "[:lower:]" "[:upper:]" | awk '{print substr(\$1,1,1)}'\`
  894.   if [ "\$PROMPT_ANSWER" != "Y" -a "\$PROMPT_ANSWER" != "N" ]; then
  895.     echo 
  896.     echo "Please answer with \\"yes\\" or \\"no\\".  Try again."
  897.   else
  898.     QUIT_WHILE=1
  899.   fi
  900. done
  901. if [ "\$PROMPT_ANSWER" != "N" ]; then
  902.   echo
  903.   echo "$UNINSTALL_LINE4"
  904.   $UNINSTALL_LINE4
  905. fi
  906. EOF
  907. if [ $? -ne 0 ]; then
  908.   echo
  909.   echo "$0: ERROR: following system command failed:"
  910.   echo "\"cat << EOF > $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_BOOK_UNINSTALL_SCRIPT\""
  911.   echo "Unable to create uninstallation script for the CyberClassroom book."
  912.   echo
  913.   cleanup 145
  914. fi
  915. fi
  916.  
  917. # Add the uninstallation option to the uninstall script if
  918. # this installation did infact install the JRE.
  919. if [ "$UNINSTALL_LINE1" != "" ]; then
  920. cat << EOF >> $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_BOOK_UNINSTALL_SCRIPT
  921. QUIT_WHILE=0
  922. while [ \$QUIT_WHILE -eq 0 ]
  923. do
  924.   echo
  925.   echo "(WARNING: If you answer yes to the following question, previous CyberClassroom"
  926.   echo "products may no longer execute properly !!!)"
  927.   echo
  928.   echo "Remove the entire JRE directory with system remove command"
  929.   echo "\\"$UNINSTALL_LINE1\\" ? (yes/no) [no]: \c"
  930.   read YES_OR_NO
  931.   if [ "\$YES_OR_NO" = "" ]; then
  932.     YES_OR_NO="no"
  933.   fi
  934.   PROMPT_ANSWER=\`echo \$YES_OR_NO | tr "[:lower:]" "[:upper:]" | awk '{print substr(\$1,1,1)}'\`
  935.   if [ "\$PROMPT_ANSWER" != "Y" -a "\$PROMPT_ANSWER" != "N" ]; then
  936.     echo 
  937.     echo "Please answer with \\"yes\\" or \\"no\\".  Try again."
  938.   else
  939.     QUIT_WHILE=1
  940.   fi
  941. done
  942. if [ "\$PROMPT_ANSWER" != "N" ]; then
  943.   echo
  944.   echo "$UNINSTALL_LINE1"
  945.   $UNINSTALL_LINE1
  946. fi
  947. EOF
  948. if [ $? -ne 0 ]; then
  949.   echo
  950.   echo "$0: ERROR: following system command failed:"
  951.   echo "\"cat << EOF >> $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_BOOK_UNINSTALL_SCRIPT\""
  952.   echo "Unable to create uninstallation script for the CyberClassroom book."
  953.   echo
  954.   cleanup 150
  955. fi
  956. fi
  957.  
  958. # add an extra echo line to the uninstall script
  959. cat << EOF >> $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_BOOK_UNINSTALL_SCRIPT
  960. echo
  961. EOF
  962. if [ $? -ne 0 ]; then
  963.   echo
  964.   echo "$0: ERROR: following system command failed:"
  965.   echo "\"cat << EOF >> $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_BOOK_UNINSTALL_SCRIPT\""
  966.   echo "Unable to create uninstallation script for the CyberClassroom book."
  967.   echo
  968.   cleanup 155
  969. fi
  970.  
  971. # make the uninstall script executable
  972. chmod a+x $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_BOOK_UNINSTALL_SCRIPT
  973. if [ $? -ne 0 ]; then
  974.   echo
  975.   echo "$0: ERROR: following system command failed:"
  976.   echo "\"chmod a+x $CYBERCLASSROOM_LOCATION/$CYBERCLASSROOM_BOOK_DIR/$CYBERCLASSROOM_BOOK_UNINSTALL_SCRIPT\""
  977.   echo "Unable to create uninstallation script for the CyberClassroom book."
  978.   echo
  979.   echo "Installation Aborted, cleaning up..."
  980.   echo
  981.   cleanup 160
  982. fi
  983.  
  984. # Finalization screen
  985.  
  986. echo
  987. echo "The Prentice Hall Deitel CyberClassroom has been sucessfully installed!"
  988. echo "Change your directory to \"$CYBERCLASSROOM_LOCATION\""
  989. echo "(cd $CYBERCLASSROOM_LOCATION) and execute the script"
  990. echo "\"$CYBERCLASSROOM_BOOK_SCRIPT\" (./$CYBERCLASSROOM_BOOK_SCRIPT) to run the program."
  991. echo
  992.  
  993.  
  994.  
  995.